Repository navigation
Pin check-test-source-alias's codeOnly projection with a literal-brace fixture - #17413
Merged
Merged
Conversation
…e fixture Add a --self-test fixture whose module-scope-vs-CLOCKED verdict hinges on a `}` inside a template literal -- the exact content maskCommentsAndLiterals exists to blank. Under correct masking the dynamic import is reported CLOCKED; under an under-masking codeOnly the stray `}` closes the real function body early and the violation goes silently unreported. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012GKcPZbMoGq7WPzKLfRBTU
baozhoutao
marked this pull request as ready for review
September 10, 2026 12:45
baozhoutao
enabled auto-merge
September 10, 2026 12:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16299
Clause-②: no
What
Adds fixture (26) to
check-test-source-alias.mjs's--self-test: a dynamicimport('@fx/core')inside anit()callback, preceded by a templateliteral whose interior contains a stray
` }`character. This pins thecodeOnlyhalf ofmaskedProjections— the projectionfunctionBodyRangesreads to decide module-scope vs CLOCKED — which #16299 measured as pinned by
nothing.
Why this shape:
functionBodyRangeswalkscodeOnlycharacter by character,pushing a frame on every
{and popping (closing a range) on every}. Undercorrect masking,
maskCommentsAndLiteralsblanks the template's interior(delimiters survive, content does not), so the stray
}never reaches thescanner and the callback's real closing brace is what pairs with its real
opener — the import lands inside
[open, close]and is reported CLOCKED.Under an under-masking
codeOnly(either ablation below), the literal}is read as real code: it pops the callback's frame early, right there inside
the template, before the dynamic import two lines down. The range this
scanner records is
[open, thatEarlyClose], the import falls outside it, andthe violation goes silently unreported — the same "silent exemption" failure
mode fixture (25) already pins for the brace scanner's backward walk, but for
the forward brace-count instead.
Two assertions added to the existing "the clocked-window rule (#10126)"
battery (floor raised 10 → 12 per #13799): the fixture's one CLOCKED finding
is reported, at the correct line, naming the correct specifier.
Ablation proof (temporary, not committed)
Both directions #16299 named, applied to
scripts/js-comment-mask.mjs'smaskCommentsAndLiterals, then reverted:--self-testbefore revertflags[k] = comment[k](degrades tomaskComments)a \}` inside a template literal closed the real function body early — the dynamic import went unreported`return source(identity — blanks nothing)After each ablation:
git checkout HEAD -- scripts/js-comment-mask.mjs,confirmed via
git status --short/git diff --stat(both empty) andgit hash-object scripts/js-comment-mask.mjsmatching the pre-ablationHEADblob hash (7956343dd85bdef8924372cb2cdec45fcd54501d) both times.Un-ablated, after revert:
node scripts/check-test-source-alias.mjs --self-test→check-test-source-alias --self-test OK(exit 0), and theplain run's output is byte-identical to the pre-change baseline
(
check-test-source-alias OK — 73 packages with tests scanned; 61 registered as still resolving a workspace dep through \dist/`; 49 publishedsubpath(s) resolved through every alias table.`) — the reverse control: the
new fixture is green un-ablated, red under both ablations.
scripts/js-comment-mask.mjswas never committed to — it is a shared fileand #16299 states it is only touched by the ablation, which is reverted.
Scope
Only
scripts/check-test-source-alias.mjschanged (fixture + 2 assertions +floor bump). No change to
scripts/js-comment-mask.mjs(shared, out ofscope). Not re-proving #15776's conversion — that proof (6,204 files /
107,177,732 chars byte-for-byte, with a 6,174-file-distinguishing control)
already lives in that PR's body; this card supplies the pin this gate itself
lacked.
Changeset
skip-changeset:scripts/check-test-source-alias.mjsis a root dev/toolingscript — it is not part of any published package's
files[](root package@objectstack/spec-monorepois"private": true;grep -rlfor the fileacross every
packages/*/package.jsonfilesentry returns nothing), sonothing published moves. Label applied to the PR.
Local verification
node scripts/check-test-source-alias.mjs --self-testand the plain run:both green, both before and after the ablation-and-revert cycle.
scripts/pm/dispatch-gates.mjs --commandsderived 32 commands for thisdiff (1 changed path,
scripts/check-test-source-alias.mjs); run directly(not through turbo — none is a package build/test), all green so far
(
pnpm check:pm-dispatch-gatesstill running per its own documenteddetach-and-poll guidance for this container).
scripts/script, not part of any package.
pnpm turbo ls --affectedreports thefull 80-package list for this diff, which is
turbo's documented blindspot for root-level, non-package changes (AGENTS.md: "仓根包不在
turbo ls里,根级套件整个在图外") rather than a real per-package signal, so ② is
also N/A — no package's own
test/typecheckis implicated.Generated by Claude Code